package com.xoa.service.hr.selfhelpInquiry;

import com.xoa.dao.hr.*;
import com.xoa.dao.hr.learningExperience.LearningExperienceMapper;
import com.xoa.dao.hr.socialRelations.SocialRelationsMapper;
import com.xoa.model.attend.AttendSet;
import com.xoa.model.hr.*;
import com.xoa.model.hr.learningExperience.LearningExperienceWithBLOBs;
import com.xoa.model.hr.socialRelations.SocialRelationsWithBLOBs;
import com.xoa.model.performance.ScoreFlowWithBLOBs;
import com.xoa.model.trainingPlanRecord.EduTrainingRecordWithBLOBs;
import com.xoa.model.users.Users;
import com.xoa.service.attend.AttendSetService;;
import com.xoa.service.hr.HrStaffReinstatementService;
import com.xoa.service.hr.HrTransferService;
import com.xoa.service.hr.HrphotoService;
import com.xoa.service.hr.impl.HrStaffContractServiceImpl;
import com.xoa.service.hr.impl.HrStaffLaborSkillsServiceImpl;
import com.xoa.service.hr.impl.HrStaffTitleEvaluationServiceImpl;
import com.xoa.service.performance.ScoreFlowService;
import com.xoa.service.trainingPlanRecord.EduTrainingRecordService;
import com.xoa.util.common.session.SessionUtils;
import com.xoa.util.common.wrapper.BaseWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @program: xoa
 * @description: 人力资源
 * @author: xiaomeng.Yu
 * @create: 2018-07-30 13:40
 **/
@Service
public class SelfhelpInquiryService {
    //社会关系
    @Autowired
    SocialRelationsMapper socialRelationsMapper;
    //学习经历
    @Autowired
    LearningExperienceMapper learningExperienceMapper;
    //证照信息
    @Autowired
    HrphotoService hrphotoMapper;
    //复职信息
    @Autowired
    HrStaffReinstatementService hrRehabMapper;
    //工作经历
    @Autowired
    HrWorkExperienceMapper hrWorkExperienceMapper;
    //人事调动
    @Autowired
    HrTransferService hrTransferMapper;
    //职称评定
    @Autowired
    HrStaffTitleEvaluationServiceImpl hrStaffTitleEvaluationMapper;
    //奖惩信息
    @Autowired
    HrStaffIncentiveMapper hrStaffIncentiveMapper;
    //劳动技能
    @Autowired
    HrStaffLaborSkillsServiceImpl hrStaffLaborSkillsMapper;
    //合同信息
    @Autowired
    HrStaffContractServiceImpl hrStaffContractServiceImpl;
    //离职信息
    @Autowired
    HrStaffLeaveMapper hrStaffLeaveMapper;
    //绩效考核
    @Autowired
    ScoreFlowService scoreFlowService;
    //培训记录
    @Autowired
    EduTrainingRecordService eduTrainingRecordService;
    //考勤记录
    @Autowired
    AttendSetService attendSetService;
    /*AttendService attendService;*/


    public BaseWrapper getHrInfo(Integer typeId,HttpServletRequest request) {
        BaseWrapper wrapper = new BaseWrapper();
        Users user = SessionUtils.getSessionInfo(request.getSession(), Users.class, new Users());
        String userId = user.getUserId();
        switch (typeId) {
            case 1:
                List<HrStaffContract> allContract = hrStaffContractServiceImpl.getAllContractSelf(userId);
                wrapper.setData(allContract);
                break;
            case 2:
                List<HrStaffIncentiveWithBLOBs> resultList2 = hrStaffIncentiveMapper.getHrStaffContractList(userId);
                wrapper.setData(resultList2);
                break;
            case 3:
                List<HrphotoWithBLOBs> resultList3 = hrphotoMapper.getUserName(request,userId);
                wrapper.setData(resultList3);
                break;
            case 4:
                List<LearningExperienceWithBLOBs> resultList4 = learningExperienceMapper.getHrStaffContractList(userId);
                wrapper.setData(resultList4);
                break;
            case 5:
                List<HrWorkExperienceWithBLOBs> resultList5 = hrWorkExperienceMapper.getHrStaffContractList(userId);
                wrapper.setData(resultList5);
                break;
            case 6:
                List<HrStaffLaborSkillsWithBLOBs> resultList6 = hrStaffLaborSkillsMapper.getUserName(userId);
                wrapper.setData(resultList6);
                break;
            case 7:
                List<SocialRelationsWithBLOBs> resultList7 = socialRelationsMapper.getHrStaffContractList(userId);
                wrapper.setData(resultList7);
                break;
            case 8:
                List<HrTransferWithBLOBs> resultList9 = hrTransferMapper.getUserName(userId);
                wrapper.setData(resultList9);
                break;
            case 9:
                List<HrStaffReinstatementWithBLOBs> resultList10 = hrRehabMapper.getUserName(request,userId);
                wrapper.setData(resultList10);
                break;
            case 10:
                List<HrStaffTitleEvaluation> resultList11 = hrStaffTitleEvaluationMapper.getUserName(userId);
                wrapper.setData(resultList11);
                break;
            case 11:
                List<EduTrainingRecordWithBLOBs> resultList12 = eduTrainingRecordService.getHrStaffContractList(userId);
                wrapper.setData(resultList12);
                break;
            case 12:
                break;
            case 13:
                List<ScoreFlowWithBLOBs> resultList14 = scoreFlowService.getUserName(userId);
                wrapper.setData(resultList14);
                break;
        }
        wrapper.setFlag(true);
        return wrapper;
    }
}
